package com.zhongzhi.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.zhongzhi.serviceimpl.PortService;
import com.zhongzhi.util.Bo;
import com.zhongzhi.util.JsonResult;
import com.zhongzhi.util.Port;
/**
 * 核心业务控制层
 * @author Administrator
 *
 */
@RestController
@RequestMapping("/doosanRadar/ds/")
public class PortController {
	@Autowired
	private PortService port;
	/**
	 * 
	 * @param kmatn		机种
	 * @param hogi		机号
	 * @param station	测试工位
	 * @param size		检测条数
	 * @return
	 */
	@RequestMapping("startdetection")
	public JsonResult startdetection(String kmatn,String hogi,String station,String size,Double upa,Double upb,Double downa,Double downb) {
		Bo startdetection = port.startdetection(kmatn, hogi, station, size,upa,upb,downa,downb);
		return new JsonResult(startdetection.getMistake(), startdetection.getMessage(),startdetection.getSize(), startdetection.getObject());
	}
	/**
	 * 
	 * @param totalsize		检测条数
	 * @param kmatn			机种
	 * @param hogi			机号
	 * @return
	 */
	@RequestMapping("querydetectionList")
	public JsonResult querydetectionList(String totalsize,String kmatn,String hogi) {
		Bo startdetection = port.querydetectionList(totalsize,kmatn,hogi);
		return  new JsonResult(startdetection.getMistake(), startdetection.getMessage(),startdetection.getSize(), startdetection.getObject());
	}
	/**
	 * 
	 * @param station		停止工位
	 * @return
	 */
	@RequestMapping("enddetection")
	public JsonResult enddetection(String station) {
		Bo startdetection = port.enddetection(station);
		return new JsonResult(startdetection.getMistake(), startdetection.getMessage(),startdetection.getSize(), startdetection.getObject());
	}
	/**
	 * 测试连接
	 * @return
	 */
	@RequestMapping("teston")
	public JsonResult teston() {
		return new JsonResult(200, "成功", 0, null);
	}
}
